<?php
    include_once "autoload.php";
    $rss = new rssbs();
    $rss->url = 'http://vnexpress.net/rss/gl/xa-hoi.rss';
    $ret_rss_des = $rss->Show();
    
    $rss->get = "TITLES";
    $ret_rss_title = $rss->Show();
?>
<html>
<head>
    <title>Auto News - Trang tu dong lay tin tuc - Hoc PHP MySQL o Ha Noi</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style type="text/css">
        a:link{
            text-decoration: none;
            color: #0080C0;
        }
        a:hover{
            text-decoration: underline;
            color: #0080FF;
        }
        a:visited{
            color: #8080C0;
        }
    </style>
</head>
<body>
    <div style="width: 190px; border: 1px silver solid; overflow: hidden; padding: 2px; position: relative;">
    <?php
            
        $sotin = 5;
        if($sotin > count($ret_rss_des))
            $sotin = count($ret_rss_des);
        
        for($i = 1; $i <= $sotin; $i++)
        {
            $tt = explode("</a>", $ret_rss_des[$i]);
            
            $link = explode("\"", $tt[0]);//lien ket
                        
            $des = explode(">", $tt[1]);//mô tả
                        
            
            echo "<div class='item' style='float: left; padding-bottom: 15px;'>";
                echo "<a href='{$link[1]}'>$ret_rss_title[$i]</a>";
                echo "<br/>"."<img src='{$link[3]}' alt='{$ret_rss_title[$i]}' align='left' />".$des[0];
            echo '</div>';
        }        
    ?>
    </div>
</body>
</html>